<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>内容列表</title>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<jsp:include page="../include.jsp" />
<style>
.bar .site {
	float: right;
}

.select {
	margin-right: 20px;
}

#tree {
	float: left;
	width: 15%;
}

#table {
	float: right;
	width: 84%;
	border-left: 1px solid #CCCCCC;
}

#middle {
	padding: 0;
	float: left;
	width: 1px;
	background: #D8DEEA;
	height: 400px;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
	  if(${fn:length(result)}==0){
		  $("#tree").css("display","none");
		  $("#middle").css("display","none");
		  $("#table").css("width","100%");
	  }
	  $("#model_id").change(function(){
	     if(this.value==-2){
			 window.location="../../modelAction/model/list.do";
			 return;
		 } 
		 if(this.value!=-1){
			 window.location="beforeAdd.do?site_id="+$("#site_id").val()+"&model_id="+$("#model_id").val()+"&model_type=1";
		 }
	  });
	  
	  $("[href='#']").click(function(){
		  var $this = $(this);
		  var url = $this.attr("url");
		  window.location=url+"&site_id="+$("#site_id").val();
	  });
});
</script>
</head>
<body class="list">
	<div class="bar">内容列表&nbsp;总记录数: ${pager.totalCount} (共${pager.pageCount}页)
	<div class="site">站点: 
		<select name="site_id" class="select" id="site_id">
			<c:forEach items="${sites}" var="site">
				<option value="${site.key}">${site.value}</option>
			</c:forEach>
		</select>
		模型: 
		<select name="model_id" class="select" id="model_id">
			<option value="-1">--选择模型--</option>
			<c:forEach items="${models}" var="model">
				<option value="${model.key}">${model.value}</option>
			</c:forEach>
			<c:if test="${fn:length(models)==0}">
				<option value="-2">添加模型</option>
			</c:if>
		</select>
	</div>
</div>
	
	<div class="body">
		<form id="listForm" action="module.do" method="post">
			<div class="listBar">
				<input type="button" class="formButton" id="add" value="上传模块" hidefocus disabled="disabled"/>
				&nbsp;&nbsp;
				<label>查找: </label>
				<select name="searchBy">
					<option value="moduleName"> 
						名称
					</option>
				</select>
				<input type="text" name="keyword" value="${pager.keyword}" />
				<input type="button" id="searchButton" class="formButton" value="搜 索" hidefocus />
				&nbsp;&nbsp;
				<label>每页显示: </label>
				<select name="pageSize" id="pageSize">
					<option value="10"<c:if test="${pager.pageSize eq 10}"> selected="selected"</c:if>>
						10
					</option>
					<option value="1"<c:if test="${pager.pageSize eq 1}"> selected="selected"</c:if>>
						1
					</option>
					<option value="20"<c:if test="${pager.pageSize eq 20}"> selected="selected"</c:if>>
						20
					</option>
					<option value="50"<c:if test="${pager.pageSize eq 50}"> selected="selected"</c:if>>
						50
					</option>
					<option value="100"<c:if test="${pager.pageSize eq 100}"> selected="selected"</c:if>>
						100
					</option>
				</select>
			</div>
			<table id="listTable" class="listTable">
				<tr>
					<th class="check"><input type="checkbox" class="allCheck" /></th>
					<th><a href="#" class="sort" name="id" hidefocus>ID</a></th>
					<th><a href="#" class="sort" name="name" hidefocus>标题</a></th>
					<th><a href="#" class="sort" name="publish" hidefocus>发布者</a></th>
					<th><a href="#" class="sort" name="hit" hidefocus>点击</a></th>
					<th><a href="#" class="sort" name="date" hidefocus>发布时间</a></th>
					<th><a href="#" class="sort" name="state" hidefocus>状态</a></th>
					<th><span>操作</span></th>
				</tr>
				<c:forEach items="${pager.list}" var="content">
				
				</c:forEach>
			</table>
			<c:choose>
				<c:when test="${fn:length(pager.list)!=0}">
					<div class="pagerBar">
						<div class="delete">
							<input type="button" id="deleteButton" class="formButton" url="unloadModule.do" value="卸载模块" disabled hidefocus />
						</div>
						<div class="pager">
							<jsp:include page="${pageContext.request.contextPath}/service/moduleAction/common/pager.jsp" />
						</div>
					</div>
				</c:when>
				<c:otherwise>
					<div class="noRecord">没有找到任何记录!</div>
				</c:otherwise>
			</c:choose>
		</form>
	</div>
</body>
</html>